#include "iostream"

using namespace std;
int main(){
    string s;
    while (cin>>s){
        int max = 0;
        for (int i = 1; i < s.length(); ++i) {
            int j = 1;
            int xmax = 0;

            while (s[i-j]==s[i+j]&&(i-j>=0&&i+j<=s.length())){
                j++;
                xmax++;
            }
            if (xmax!=0){
                xmax=xmax*2+1;
            }
            if (xmax>max){
                max =xmax;
            }

        }
        cout<<max<<endl;
    }
    return 0;
}
